package thread;
//线程的打断
public class demo8 {
    private static boolean isQuit = false;
    public static void main(String[] args) throws InterruptedException {
         Thread t = new Thread(()->{
             while (!isQuit){
                 System.out.println("working");
                 try {
                     Thread.sleep(1000);
                 } catch (InterruptedException e) {
                     throw new RuntimeException(e);
                 }
             }
             System.out.println("end");
         });

         t.start();
         Thread.sleep(5000);
         isQuit = true;
         System.out.println("false->true");
    }
}
